package com.example.xjtuse_pc.mobilesafe;

import android.content.Context;
import android.test.AndroidTestCase;
import android.test.InstrumentationTestCase;
import android.util.Log;

import com.example.xjtuse_pc.db.dao.BlackNumberDao;
import com.example.xjtuse_pc.domain.BlackNumberInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created by XJTUSE-PC on 2016/4/11.
 */
public class TestBalckNumber extends AndroidTestCase {

    public void test1(){
        BlackNumberDao dao=new BlackNumberDao(getContext());
            dao.add("18090010011", "1");

        }
    public void testfind(){
        BlackNumberDao dao=new BlackNumberDao(getContext());
            Boolean a=dao.find("18090010011");
            Log.i("join", String.valueOf(a));
            }

    public void testfindmode(){
        BlackNumberDao dao=new BlackNumberDao(getContext());
            String mode=dao.findMode("18090010011");
            Log.i("join", mode);
            }
    public void testUpdataMode(){
        BlackNumberDao dao=new BlackNumberDao(getContext());
        dao.updataMode("18090010011","3");

    }
    public void testAddAll(){
        BlackNumberDao dao=new BlackNumberDao(getContext());
        Random random = new Random();
        for(int i=0;i<30;i++){
            dao.add((1809279600+i)+"",String.valueOf(random.nextInt(3) + 1));
        }
    }
    public  void testFindall(){
        BlackNumberDao dao=new BlackNumberDao(getContext());
        List<BlackNumberInfo> list=new ArrayList<BlackNumberInfo>();
        list=dao.findAll();
        int i=0;
        while(i<list.size()){
            Log.i("join", list.get(i).toString());
            i++;
        }
    }

}
